class CreateUsers < ActiveRecord::Migration
  def self.up
    # I'm not very familiar with migrate,
    # so do the work dirty by using raw SQL.
    # Only works for MySQL!
    execute "CREATE TABLE users (
      id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
      name VARCHAR(12) NOT NULL UNIQUE,
      email VARCHAR(50) NOT NULL UNIQUE,
      hashed_password VARCHAR(40) NOT NULL,
      nick_name VARCHAR(50),
      avatar VARCHAR(150) DEFAULT 'avatar.jpg',
      sex ENUM('Male','Female'),
      location VARCHAR(20),
      hometown VARCHAR(20),
      website VARCHAR(50),
      description VARCHAR(400),
      privacy ENUM('T','F') DEFAULT 'F',
      last_login TIMESTAMP    
    );"
  end

  def self.down
    drop_table :users
  end
end
